package com.sd.projectinterface;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

@SuppressLint("ParserError")
public class MainActivity extends Activity {
	
	private Button create, myGames, myAssignments, myStats;
	private int id;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //Bundle incoming = this.getIntent().getExtras();
        //id = incoming.getInt("j");
        create = (Button) findViewById(R.id.home_create_game);
        myGames = (Button) findViewById(R.id.my_games);
        myAssignments = (Button) findViewById(R.id.my_assignments);
        myStats = (Button) findViewById(R.id.my_stats);
        MyApplication myApp = (MyApplication) getApplicationContext();
        id = myApp.getId();
        registerButtonListenersAndSetDefaultText();
    }
    
    public void registerButtonListenersAndSetDefaultText(){
    	create.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, CreateGame.class);
				i.putExtra("j", id);
		    	startActivity(i);
			}
    	});
    	
    	myGames.setOnClickListener(new View.OnClickListener() {	
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, MyGames.class);
				i.putExtra("j", id);
		    	startActivity(i);
			}
		});
    	
    	myAssignments.setOnClickListener(new View.OnClickListener() {	
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, MyAssignments.class);
				startActivity(i);
			}
		});
    	
    	myStats.setOnClickListener(new View.OnClickListener() {	
			public void onClick(View v) {
				Intent i = new Intent(MainActivity.this, MyStats.class);
				startActivity(i);
			}
		});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	super.onCreateOptionsMenu(menu);
    	MenuInflater mi = getMenuInflater();
        mi.inflate(R.menu.main, menu);
        return true;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
     super.onActivityResult(requestCode, resultCode, intent);
    }
}
